<?php

//服务器和数据库信息
$servername = "localhost";
$username = "root";
$password = "";
$dbName = "mysql";
$tableName  = "myguest";

// 创建连接
$conn = new mysqli($servername, $username, $password, $dbName);
 
// 检测连接
if ($conn->connect_error) {
  die("连接失败: " . $conn->connect_error);
}


$sql = "SHOW tables";
$result = $conn->query($sql);
// var_dump($result->num_rows);

while($row = $result->fetch_assoc()){
  
  var_dump($row);
}

$conn->select_db('mydb');
$sql = "SHOW tables";
$result = $conn->query($sql);
// var_dump($result->num_rows);

while($row = $result->fetch_assoc()){
  
  var_dump($row);
}
